package day07;
import java.util.Scanner;

public class PrimeNumber {
    public static void main(String[] args){

        Scanner scan = new Scanner(System.in);
        System.out.println("您想要查看哪个数之前的素数,请输入：");
        int num = scan.nextInt();
        System.out.println(num+"之前的素数如下：");
        for (int i = 2; i < num; i++) {
            boolean flag = true;
            for (int j = 2; j <= i/2; j++) {
                if (i%j==0){
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.print(i+"\t");
            }
        }
    }
}
